package designMode.composite;

/**
 * @Description
 * @Author 肖地洋
 * @Date 2022/8/18 16:43
 */
public class Main {

    public static void main(String[] args) {
        // Create a root folder
        Root root = new Folder("C://");

        // Create a folder
        Root desktop = new Folder("桌面");
        Root myComputer =  new Folder("我的电脑");

        // establish subfolders
        Root javaFile = new File("hello world.java");

        // establishing a folder relationship
        root.addFile(desktop);
        root.addFile(myComputer);

        // Establishing a file relationship
        myComputer.addFile(javaFile);

        //display from level 0
        root.display(0);


    }
}
